package cn.llming.auth.service.impl;

import cn.llming.auth.domain.RoleMenu;
import cn.llming.auth.domain.SystemPermission;
import cn.llming.auth.mapper.PermissionMapper;
import cn.llming.auth.mapper.RoleMenuMapper;
import cn.llming.auth.query.PermissionQuery;
import cn.llming.auth.service.IPermissionService;
import cn.llming.basic.query.BaseQuery;
import cn.llming.vo.result.ListPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private PermissionMapper permissionMapper;



    @Override
    public ListPage<SystemPermission> getPageList(BaseQuery query) {
       long total= permissionMapper.getTotal(query);

       if(total>0){

          List<SystemPermission> rows= permissionMapper.getPageList(query);

          return new ListPage<>(total, rows);
       }
       return new ListPage<>();
    }

    @Override
    public List<SystemPermission> getTree() {
        return permissionMapper.getTree();
    }

    @Override
    public List<String> getSns() {
        return permissionMapper.getSnes();
    }
//
//    @Override
//    public List<RoleMenu> getRoleMenuTree() {
//        return permissionMapper.getRoleMenuTree();
//    }


}
